<!DOCTYPE html>
<html th:lang="${language}" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('用户列表')" />

</head>
<body>
<div class="col-sm-12 select-table table-striped">
    <table id="bootstrap-table"></table>
</div>


<th:block th:include="include :: footer" />
<script th:inline="javascript">
    var prefix = "/operating"
    queryKrList()

    function queryKrList(){
        $(function (){
                var options = {
                    url : prefix + "/getKrsList",
                    onDblClickRow: onDbClick,
                    showSearch:false,
                    columns : [
                        {
                            field: 'id',
                            visible: false
                        },
                        {
                            field: 'userId',
                            visible: false
                        },
                        {
                            field: 'content',
                            title: 'Kr描述'
                        },
                        {
                            field: 'process',
                            title: "进度",
                            formatter: function (value, row, index) {
                                return '<span class="badge badge-success">' + value  + '%</span>';
                            }
                        },
                        {
                            field: 'scoreStar',
                            title: [[#{okr.scoreStar}]],
                            formatter: function (value, row, index) {
                                return '<span class="badge badge-success">' + value  + '</span>';
                            }
                        },
                        {
                            field: 'confidenceStar',
                            title: [[#{okr.confidenceStar}]],
                            formatter: function (value, row, index) {
                                return '<span class="badge badge-success">' + value + '</span>';
                            }
                        }
                    ]
                }
                $.table.init(options)
            }
        )
    }

    function onDbClick(row, $element){
      $.ajax({
          url: ctx + "operating/getParentOkr",
          data: {'krId' : row.id},
          type: 'POST',
          success: function(data){
              $.modal.openTab("查看OKR", ctx + "okr/info/view/" + data);
          }
      })

    }
</script>
</body>
</html>